{include file="public/head"/}
<script language="javascript">
    $(document).ready(function () {
        var lang = $('#lang').text();
        var language = '';
        if (lang == 'pt-br') {
            language = 'pt-BR';
            format = 'mm-dd-yyyy';
        } else if (lang == 'en-us') {
            language = 'en';
            format = 'mm-dd-yyyy';
        } else {
            language = 'zh-CN';
            format = 'yyyy-mm-dd'
        }
        //设置modal垂直居中,移动
        // modalSetting(".modal");
        // datatimepicker 设置
        $('.form_datetime').datetimepicker({
            language: language, // en ,zh-CN, pt-BR
            format: format,
            minView: 'month',
            weekStart: 0, //一周从哪一天开始
            todayBtn: 1, //
            autoclose: 1,
            todayHighlight: 1,
            startView: 2,
            forceParse: 0,
            showMeridian: 1
        });
    });
</script>

<div id="main">
<!--search框开始-->
<div class="row clearfix" id="search-box" style="display:none;margin-top:0">
    <div class="col-md-12 text-right">
        <div>
            <form class="form-inline" role="form">

                <div class="form-group">
                    <!-- <label for="name">search{:lang('add/alterar_bank_account')}</label> -->
                    <input type="text" class="form-control" id="name" placeholder="请输入公司名称，产品名称，型号，角色ID" v-model="search">
                </div>
                <div class="form-group">
                    <button type="button" class="btn btn-default btn-primary" @click="render"><span class="glyphicon glyphicon-search"></span>{:strtoupper(lang('search'))}</button>
                </div>
            </form>
		</div>
	</div>
</div>

<!--search框结束-->


<div class="container-fluid" >

    <input type="hidden" id="admin_ids" value="{$admin_ids}">
    <div class="row clearfix">
        <div class="col-md-12 column">
            <div class="alert alert-dismissable alert-info" ref="alert">
                <button type="button" class="close">×</button>
                <p ref="info"></p>
            </div>
        </div>
    </div>
   
   
    <div class="ntDesktop">
    	<div class="ntDesktop-head">{:strtoupper(lang("purchase_plan_list"))}</div>
    
        <div class="row clearfix" style="padding-top:0px">
            <div class="col-md-2 text-right">
                <ul class="nav nav-tabs">
                    <li v-if="isshow_search" class="active">
                        <a href="#home" data-toggle="tab" class="ptlang"
                        >搜索结果<span class="glyphicon glyphicon-remove shdow" style="margin-left: 10px;" @click="shdow"></span></a>
                    </li>
                    <li :class="{'active': item==0 && !isshow_search}"><a href="#" data-toggle="tab" @click="changeitem(0)">{:strtoupper(lang('product'))}</a></li>
                    <li :class="{'active': item==1 && !isshow_search}"><a href="#" data-toggle="tab" @click="changeitem(1)">{:strtoupper(lang("accessory"))}</a></li>
                </ul>
            </div>
            <div class="col-md-5 text-right" v-cloak>
                <ul class="nav nav-tabs">
                    <input type="hidden" id="month_" value="{$month}">
                    <li :class="{'active':month==item.month}" v-for="(item,index) in montharr"><a href="#" data-toggle="tab" @click="changemonth(item.year,item.month)">{{index==0 ? lang_month[0] : lang_month[item.month]}}</a></li>
                </ul>            	
            </div>
            <div class="col-md-5 text-right">
                <div>
                    <!-- <a href="{:url('buy/plan_addnew')}" class='btn btn-primary' ><span class="glyphicon glyphicon-plus"></span> {:strtoupper(lang("add_purchase_plan"))}</a> -->
                    <a :href="'/admin/buy/plan_addnew?month='+month"  class='btn btn-primary' v-if="auth_ids.indexOf(204) != -1" @click="setStorage()">
                        <span class="glyphicon glyphicon-plus"></span> {:strtoupper(lang("add_purchase_plan"))}</a>
                    <a href="javascript:;" class='btn btn-primary' @click="banckfun" v-if="auth_ids.indexOf(207) != -1"  @click="setStorage()">
                        <span class="fa fa-file-powerpoint"></span> {:strtoupper(lang("purchase_plan_generation_contract"))}</a>
                    <button class='btn btn-default' @click="delfun(batch)" v-if="auth_ids.indexOf(208) != -1">
                        <span class="glyphicon glyphicon-trash"></span> {:strtoupper(lang('batch_delete'))}</button>
                </div>
            </div>
        </div>
    
        <div class="row clearfix">
            <div class="col-md-12 column">
                <input type="hidden" ref="waner" value="请选择要生成合同的计划">
                <table class="table table-striped table-hover ntTable" v-cloak>
                    <thead>
                        <tr>
                            <th style="text-align:center"><input type="checkbox" id="allche" @click="allsel" /> </th>
                            <th class="sorting"> No. </th>
                            <th>&nbsp;  </th>
                            <th> {:strtoupper(lang('product'))} </th>
                            <th> {:strtoupper(lang("quantity"))} </th>
                            <th> {:strtoupper(lang("box_measure"))} </th>
                            <th> {:strtoupper(lang("price"))} </th>
                            <th> {:strtoupper(lang("purchase"))} </th>
                            <th class="sorting"> {:strtoupper(lang("delivery_time"))} </th>
                            <th> {:strtoupper(lang('edit'))} </th>
                            <th> {:strtoupper(lang('operate'))} </th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr v-for="(item,index) in listdata" :key="item.id">
                            <td style="vertical-align:middle" class="text-center"><input type="checkbox"  class="tablecheckbox"  @click="onesel(item.id,item.prochar_id)"  v-if="admin_ids.indexOf(item.create_id) != -1 || admin_ids.indexOf(1) != -1 " /></td>
                            <td style="vertical-align:middle">{{formatUnit(item.id,'ID')}}</td>
                            <td style="vertical-align:middle"><a :href="'/admin/product/productDetail?request=detail&id='+item.pro_id" target="_blank"><img :src="item.img_url" border="0"></a></td>
                            <td> <small>{{formatUnit(item.prochar_id,'ID') + (item.brand_name ? ' / '+item.brand_name : '') + (item.model ? ' / '+item.model : '')}}</small> <br /><a :href="'/admin/product/productDetail?request=detail&id='+item.pro_id" target="_blank">{{ (item.itemPro_name ? item.itemPro_name + ' / ':'') + item.pro_name}}</a></td>
                            <td align="right"> {{formatUnit(item.qty ? item.qty : '-','UN')}} <span class="unit">CTN</span><br /> {{formatUnit(item.qty_sum ? item.qty_sum : '-','UN')}} <span class="unit">PCS</span></td>
                            <td align="right">
                            	{{item.ctn_qty ? item.ctn_qty : '-'}} <span class="unit">PCS/CTN</span> | {{formatUnit(item.ctn_kgs,'KG')}} <span class="unit">KGS</span><br>
                                {{item.ctn_size}} <span class="unit">CM</span> | {{formatUnit(item.ctn_m3,'M3')}} <span class="unit">CBM</span>
                            </td>
                            <td align="right"> {{formatUnit(item.price,'$')}} <span class="unit">CNY</span><br> {{formatUnit(item.price_sum,'$')}} <span class="unit">CNY</span></td>
                            <td> {{item.nickname}} <br> <small> {{item.company_name}} </small> </td>
                            <td> {{item.delivery_time}} <br /> <small>{{item.address}}</small> </td>
                            <td> {{item.create_name}} <br /><small> {{item.create_time}} </small></td>
                            <td style="vertical-align:middle" class="text-right">
                                <div>
                                    <a :href="'/admin/buy/plan_editnew?id='+item.id" class='btn btn-sm btn-primary' v-if="auth_ids.indexOf(205) != -1"  @click="setStorage()">
                                        <span class="glyphicon glyphicon-pencil"></span> {:strtoupper(lang('edit'))}</a>
                                    <a href="#" class='btn btn-sm btn-default' @click="delfun(item.id)" v-if="auth_ids.indexOf(206) != -1">
                                        <span class="glyphicon glyphicon-trash"></span> {:strtoupper(lang('delete'))}</a>
                                </div>
                            </td>
                        </tr>
                        <tr><td colspan="11" style="text-align: center;" v-if="listdata.length==0" class="no_date">{:strtoupper(lang('no_data'))}</td></tr>
                    </tbody>
                </table>
                <ul class="pagination" id="pagination" v-show="listdata.length!=0">
                </ul>
            </div>
        </div>
    </div>
</div>
</div>
<script src="/static/Admin/js/plan.js"></script>
{include file="public/foot"/}